package com.f1ussh.serviceuser.config;

import com.alibaba.cloud.nacos.NacosDiscoveryProperties;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;


/**
 * @Author: 马腾飞
 * @CreateTime: 2025-09-30
 * @Description: Nacos配置类
 * @Version: 1.0
 */


@Component
public class NacosConnectionInitializer implements ApplicationRunner {

    private static final Logger logger = LoggerFactory.getLogger(NacosConnectionInitializer.class);

    @Autowired
    private NacosDiscoveryProperties discoveryProperties;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        logger.info("=== Nacos连接信息 ===");
        logger.info("Nacos服务器: {}", discoveryProperties.getServerAddr());
        logger.info("服务名称: {}", discoveryProperties.getService());
        logger.info("命名空间: {}", discoveryProperties.getNamespace());
        logger.info("组: {}", discoveryProperties.getGroup());
        logger.info("=== 连接检查完成 ===");
    }
}
